package source.s02.t6;


public class Task {

	private String getData1;
	private String getData2;

	public  void doLongTimeTask() {
		try {
			System.out.println("begin task");
			Thread.sleep(3000);
			String getData111 = "long time task return1 threadName="
					+ Thread.currentThread().getName();
			String getData211 = "long time task return2 threadName="
					+ Thread.currentThread().getName();

			synchronized(this){//锁定当前对象
				getData1=getData111;
				getData2=getData211;
			}
			System.out.println(getData1);
			System.out.println(getData2);
			System.out.println("end task");
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
